package net.asrsmid.invoker.as;

/**
 * A DimensionOutOfBoundException is thrown when the required dimension exceeds the table's bound 
 * @author Chen WANG
 * @since 20 June 2011
 */
public class DimensionOutOfBoundException extends TableException {
	private static final long serialVersionUID = 1L;
	
	/**
	 * Constructs a DimensionOutOfBoundException when the given fields
	 * @param dim the required dimension
	 * @param maxDim table's maximum dimension
	 */
	public DimensionOutOfBoundException(int dim, int maxDim) {
		super(composeMsg(dim, maxDim));
	}
	
	private static String composeMsg(int dim, int maxDim) {
		StringBuilder sb = new StringBuilder("Dimension ");
		sb.append(dim).append(" out of bound ").append(maxDim);
		
		return sb.toString();
	}
}
